package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-03-27
 * Time: 18:18
 */

interface IShape{    //接口定义
    public static final int age = 1; //默认用public static final 修饰成员变量
    public abstract void draw();    //默认用public abstract 修饰成员方法
    public static void draw2(){
        System.out.println("1234");
    }
    default public void draw3(){
        System.out.println("1234");
    }
}

class Cycle implements IShape{     //某一个类实现一个接口，必须重写接口中的抽象方法
    @Override
    public void draw() {
        System.out.println("圆圈");
    }

    @Override
    public void draw3() {          //不是必须重写的方法
        System.out.println("觉得父接口这默认方法不好，我自己写");
    }
}
class Rect implements IShape{
    @Override
    public void draw() {
        System.out.println("矩形");
    }
}

public class Test {
    public static void  shapeMap(IShape iShape){
        iShape.draw();
    }
    public static void main(String[] args) {
       // IShape a = new IShape();     //不能通过new来进行实例化
        shapeMap(new Cycle());
        shapeMap(new Rect());
    }
}
